package com.example.netty.service.shiplogdevice;

import com.example.netty.common.FluxQuery;
import com.example.netty.pojo.ShiplogDevice;
import com.influxdb.client.InfluxDBClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class ShiplogDeviceServiceImpl {
    @Autowired
    InfluxDBClient influxDBClient;

    public ShiplogDevice findOne(String bucketName){
        return FluxQuery.newFindOne(influxDBClient,bucketName,"-24h","ShiplogDevice",ShiplogDevice.class);
    }

    public ShiplogDevice findOneData(String bucketName,String time) throws Exception {
        return FluxQuery.findOneData(influxDBClient,bucketName,time,"ShiplogDevice",ShiplogDevice.class);
    }
}
